package com.freesky.web.manager.remote.order;

import com.freesky.common.pojo.DataTablesResult;
import com.freesky.common.utils.reponse.JSONResponse;
import com.freesky.common.utils.reponse.JSONResponseDiretor;
import com.freesky.common.vo.VOItem;
import com.freesky.web.manager.remote.order.fallback.ItemRemoteFallback;
import com.freesky.web.manager.remote.order.fallback.OrderRemoteFallback;
import com.freesky.web.manager.vo.VOOrderDetail;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@FeignClient(name = "emall-provider-zuul", fallback = OrderRemoteFallback.class)
public interface OrderRemote {
    String ZUUL_URL_PREFIX = "/mysevice/order";
    String URL_PREFIX = "/order";

    @GetMapping(value = ZUUL_URL_PREFIX + URL_PREFIX + "/list")
    DataTablesResult getOrderList(
            @RequestParam(value = "draw") int draw,
            @RequestParam(value = "start") int start,
            @RequestParam(value = "length") int length,
            @RequestParam(value = "search[value]") String search,
            @RequestParam(value = "order[0][column]") int orderCol,
            @RequestParam(value = "order[0][dir]") String orderDir);

    @GetMapping(value = ZUUL_URL_PREFIX + URL_PREFIX + "/count")
    JSONResponse getOrderCount();

    @GetMapping(value = ZUUL_URL_PREFIX + URL_PREFIX + "/detail/{orderId}")
    JSONResponse getOrderDetail(@PathVariable(value = "orderId") String orderId);

    @PostMapping(value = ZUUL_URL_PREFIX + URL_PREFIX + "/remark")
    JSONResponse remark(
            @RequestParam(value = "orderId") String orderId,
            @RequestParam(value = "message", required = false) String message);

    @PostMapping(value = ZUUL_URL_PREFIX + URL_PREFIX + "/deliver")
    JSONResponse deliver(
            @RequestParam(value = "orderId") String orderId,
            @RequestParam(value = "shippingName") String shippingName,
            @RequestParam(value = "shippingCode") String shippingCode,
            @RequestParam(value = "postFee") BigDecimal postFee);

    @GetMapping(value = ZUUL_URL_PREFIX + URL_PREFIX + "/cancel/{orderId}")
    JSONResponse cancelOrderByAdmin(@PathVariable(value = "orderId") String orderId);

    @DeleteMapping(value = ZUUL_URL_PREFIX + URL_PREFIX + "/del/{ids}")
    JSONResponse delete(@PathVariable(value = "ids") String[] ids);

}
